package com.matt.foundation.vo.course;

import com.matt.domain.course.CourseTopic;
import com.matt.foundation.DO.ClassesTopicDO;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/3/22
 * *******************************
 */
@Data
public class WebCourseTopicClassesVo {
    private String topicId;
    private String topicName;
    private List<String> classesName;

    public static WebCourseTopicClassesVo of(CourseTopic courseTopic, List<ClassesTopicDO> classesTopicDOS){
        WebCourseTopicClassesVo vo = new WebCourseTopicClassesVo();
        vo.setTopicId(courseTopic.getId());
        vo.setTopicName(courseTopic.getName());
        vo.setClassesName(classesTopicDOS.stream().map(o->o.getClassesName().toString()).collect(Collectors.toList()));
        return vo;
    }
}
